<template>
  <!--  标签  -->
  <div class="head">
    <div class="min">
      <div class="add">
        <i class="el-icon-plus"></i>
        <span>新增</span>
      </div>
      <div class="search">
        <i class="el-icon-refresh"></i>
        <i class="el-icon-share"></i>
        <div style="background: #2f2f2f">
          <i class="el-icon-search"></i>
          <el-input
            v-model="input"
            placeholder="请输入内容"
            size="small"
            maxlength="200"
          ></el-input>
        </div>
      </div>
      <ul class="list">
        <li v-for="(item, index) in list" :key="index">
          <div class="set">
            <span @click="add(item)">{{ index }}</span>
            <div>
              <div><i class="el-icon-edit-outline"></i><span>编辑</span></div>
              <div>
                <i class="el-icon-document-delete"></i><span>删除</span>
              </div>
            </div>
          </div>
          <div class="lable">
            <tagsGroup :tags="item" :showTagsArr="idList"></tagsGroup>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import tagsGroup from "../components/common/tagsGroup";
export default {
  name: "Title",
  data() {
    return {
      hh: "",
      list: [],
      idList: [],
      input: "",
    };
  },
  created() {
    this.findAllGroupByCateGory();
    this.findAllTag();
  },
  methods: {
    async findAllGroupByCateGory() {
      let data = await this.$api.findAllGroupByCateGory();
      console.log(222, data);
      this.list = data;
      console.log(this.list);
    },
    async findAllTag() {
      let data = await this.$api.findAllTag();
      console.log(222, data);
      for (let i in data) {
        this.idList.push(data[i].id);
      }
      console.log(this.idList);
    },
    add(item) {
      console.log(item);
    },
  },

  components: {
    tagsGroup,
  },
};
</script>

<style scoped lang="less">
* {
  margin: 0;
  padding: 0;
}
.min {
  width: 100%;
  height: 100vh;
  padding: 17px 60px 0 40px;
  background: #383838;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  .add {
    width: 94px;
    height: 36px;
    background: #1890ff;
    border-radius: 5px;
    font-size: 16px;
    font-family: Alibaba PuHuiTi;
    font-weight: 400;
    color: #ffffff;
    line-height: 36px;
    text-align: center;
  }
  .search {
    height: 36px;
    display: flex;
    line-height: 36px;
    i {
      margin-right: 6px;
      margin-top: 10px;
      font-size: 18px;
      color: #cccccc;
    }
    div {
      height: 36px;
      width: 344px;
      line-height: 36px;
      border: 1px solid black;
      /deep/.el-input {
        width: 80%;
        height: 28px;
        margin-top: 2px;
        border: none;
        /deep/.el-input__inner {
          height: 88%;
          border: none;
          outline-style: none;
          background: #2f2f2f;
        }
      }
    }
  }
  .list {
    width: 100%;
    height: calc(100% - 36px);
    margin-left: 40px;
    li {
      margin-top: 21px;
      padding-bottom: 45px;
      border-bottom: 1px solid #cccccc;
      .set {
        display: flex;
        color: #ffffff;
        justify-content: space-between;
        height: 28px;
        div {
          display: flex;
          margin-right: 6px;
          div {
            width: 88px;
            height: 28px;
            line-height: 28px;
            border-radius: 5px;
            background: #e64f4f;
            i {
              margin: 7px 4px 7px 20px;
            }
          }
          div:nth-child(1) {
            background: #1890ff;
          }
        }
      }
      .lable {
        display: flex;
        div {
          padding: 0 8px;
          height: 20px;
          box-sizing: border-box;
          border-radius: 2px;
          margin-right: 10px;
          font-size: 14px;
          font-family: Alibaba PuHuiTi;
          font-weight: 400;
          color: #ffffff;
        }
      }
    }
  }
}
</style>
